package com.zkthink.ceres.promotion.entity;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zkthink.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

/**
 * <p>
 * 实体类 分销员
 * </p>
 *
 * @author kellen
 * @since 2020-08-22
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_sales")
@ApiModel(value = "Sales", description = "分销员")
@AllArgsConstructor
public class Sales extends Entity<Long> {

  private static final long serialVersionUID = 1L;

  /**
   * 手机号
   */
  @ApiModelProperty(value = "手机号")
  @NotEmpty(message = "手机号不能为空")
  @Length(max = 32, message = "手机号长度不能超过32")
  @TableField(value = "mobile", condition = LIKE)
  @Excel(name = "手机号")
  private String mobile;

  /**
   * 用户id
   */
  @ApiModelProperty(value = "用户id")
  @NotNull(message = "用户id不能为空")
  @TableField("mid")
  @Excel(name = "用户id")
  private Long mid;

  /**
   * 分销等级
   */
  @ApiModelProperty(value = "分销等级")
  @NotNull(message = "分销等级不能为空")
  @TableField("level_id")
  @Excel(name = "分销等级")
  private Long levelId;

  /**
   * 上级id
   */
  @ApiModelProperty(value = "上级id")
  @NotNull(message = "上级id不能为空")
  @TableField("pid")
  @Excel(name = "上级id")
  private Long pid;

  /**
   * 是否有效 1是 2否
   */
  @ApiModelProperty(value = "是否有效 1是 2否")
  @NotNull(message = "是否有效 1是 2否不能为空")
  @TableField("is_valid")
  @Excel(name = "是否有效 1是 2否")
  private Integer isValid;

  /**
   * 邀请码
   */
  @ApiModelProperty(value = "邀请码")
  @NotNull(message = "邀请码不能为空")
  @TableField("invite_id")
  @Excel(name = "邀请码")
  private Integer inviteId;

  /**
   * 逻辑删除 1-删除 0-未删除
   */
  @ApiModelProperty(value = "逻辑删除 1-删除 0-未删除")
  @NotNull(message = "逻辑删除 1-删除 0-未删除不能为空")
  @TableField("is_delete")
  @Excel(name = "逻辑删除 1-删除 0-未删除")
  @TableLogic
  private Integer isDelete;


  @ApiModelProperty(value = "审核状态 0待审核 1审核通过 2审核拒绝")
  private Integer auditStatus;


  private String tenantCode;


  @Builder
  public Sales(Long id, LocalDateTime updateTime, Long updateUser, LocalDateTime createTime,
      Long createUser,String mobile, Long mid, Long levelId, Long pid, Integer isValid,
      Integer inviteId, Integer isDelete, Integer auditStatus, String tenantCode) {
    this.id = id;
    this.updateTime = updateTime;
    this.updateUser = updateUser;
    this.createTime = createTime;
    this.createUser = createUser;
    this.mobile = mobile;
    this.mid = mid;
    this.levelId = levelId;
    this.pid = pid;
    this.isValid = isValid;
    this.inviteId = inviteId;
    this.isDelete = isDelete;
    this.auditStatus = auditStatus;
    this.tenantCode = tenantCode;
  }

}
